function getData() {
	var timer=document.getElementById("timer").value;
	var Regx = /^[0-9]*$/;
	if(Regx.test(timer)){	
		timer=parseFloat(timer);
		timer=timer*1000;
		getData1();
		interval=setInterval(getData1,timer);
	}
	else alert("请输入正确的定时时间");
}




function getData1(){
	var xmlhttp;//Ajax对象	
	var txt1 = document.getElementById("txt1");
	var sql=document.getElementById("select").value;	
	var timer=document.getElementById("timer").value;
	if (window.XMLHttpRequest)//ie7+ firefox,chrome,safari,opera
		xmlhttp = new XMLHttpRequest();//创建Ajax对象
	else
		//ie5,ie6
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");//创建Ajax对象
	//Ajax对象连接服务器，GET方式，异步方式
	xmlhttp.open("GET", "servlet/AjaxDemo?sql="+sql+"&timer="+timer+"&time="+new Date().getTime(), true);
	//Ajax对象发送请求
	xmlhttp.send();
	//Ajax发送数据
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.status == 200 && xmlhttp.readyState == 4) {
			txt1.value = xmlhttp.responseText;				
		}
	};

}